


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt"%>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
	String applicationPath = basePath + "/" + "application";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>选择项目</title>
		<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet"
			type="text/css" />
		<script language="javascript" src="<%=path%>/js/util.js"></script>

		<script type="text/javascript">
    	function selectproject(){
    		var tempName = document.getElementById("projectname").value;    		
    		var tempId =  document.getElementById("id").value;
    	}
	</script>
	</head>
	<body>

		<html:form styleId="projectworksheetsForm"
			action="listProjectworksheets.do?method=getProjectworksheetsPartialList">
			<input type="hidden" id="totalPage" value="${totalPage}" />
			<input type="hidden" id="bussinessType" value="${bussinessType}" />
			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="margtb5">
				<tr>
					<td align="left" class="padl5 lan12">
						<img src="<%=path%>/images/img-11.gif" width="12" height="12">
						&nbsp;待选择项目列表&nbsp;
					</td>
				</tr>
			</table>

			<table cellspacing="3" cellpadding="0" width="98%" align="center"
				border="0" class="kuang2 margtb5 hei12">
				<tr>
					<td width="15%" align="right">
						<bean:message
							key="com.application.projectworksheets.entity.projectworksheets.listpage.year"
							bundle="projectworksheets" />
						：
					</td>
					<td width="10%">


						<ssh:select propertyName="year" dataSource="collection"
							selectList="${yearSelect}" type="1"
							defaultName="${projectworksheetsForm.year}" />
					</td>
					<td width="14%" align="right">
						<bean:message
							key="com.application.projectworksheets.entity.projectworksheets.listpage.projectid"
							bundle="projectworksheets" />
						：
					</td>
					<td width="15%">


						<html:text property="projectid" />
					</td>
					<td width="15%" align="right">
						<bean:message
							key="com.application.projectworksheets.entity.projectworksheets.listpage.projectname"
							bundle="projectworksheets" />
						：
					</td>
					<td width="15%">


						<html:text property="projectname" />
					</td>
					<td align="center">
						<input class="buttonbg" id="but_query" type="button"
							value="<bean:message key='com.syc.common.projectworksheets.query'  bundle="projectworksheets"/>"
							name="but_query" onClick="query();" />
					</td>
				</tr>
			</table>


			<table cellspacing="0" cellpadding="0" width="98%" align="center"
				border="0" class="margb5">
				<tr>
					<td>
						<fmt:bundle
							basename="com.application.projectworksheets.struts.ApplicationResources_projectworksheets">
							<display:table name="projectworksheetsList" class="simple"
								id="projectworksheets" pagesize="10" partialList="true"
								defaultsort="1" defaultorder="descending" size="resultSize"
								requestURI="listProjectworksheets.do?method=getProjectworksheetsPartialList">
								<display:column style="width:5%; text-align:center;">
									<input type="checkbox" name="id"
										onclick="setProjectName('${projectworksheets.id}','${projectworksheets.projectname}','${projectworksheets.projectid}','${projectworksheets.undertakedepar}','${projectworksheets.undertakedeparid}','${projectworksheets.cost}');"
										value="${projectworksheets.id}" headerClass="sortable" />
								</display:column>


								<display:column property="projectname"
									titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.projectname"
									sortable="true" style="width:10%; text-align:center;" />

								<display:column property="projectid"
									titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.projectid"
									sortable="true" style="width:5%; text-align:center;" />

								<display:column property="undertakedepar"
									titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.undertakedepar"
									sortable="true" style="width:5%; text-align:center;" />

								<display:column property="principal"
									titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.principal"
									sortable="true" style="width:5%; text-align:center;" />
							   <display:column property="year" titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.year" sortable="true" style="width:5%;text-align:center;"/>
									
							</display:table>
						</fmt:bundle>
					</td>
				</tr>
			</table>

		</html:form>
	</body>
</html>
<script>

function query(){
	document.forms[0].action="listProjectworksheets.do?method=getProjectworksheetsPartialList&idText=${idText}&nameText=${nameText}&bussinessType="+$('bussinessType').value;
	document.forms[0].submit();
}

//新增
function addProjectworksheets(){
    document.forms[0].action="toAddProjectworksheets.do?method=toAddProjectworksheets";
	document.forms[0].submit();
}

//修改
function modifyProjectworksheets(){
    var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	        alert("一次只能编辑一条记录！");
		return;
	}else{
		document.forms[0].action="toUpdateProjectworksheets.do?method=toUpdateProjectworksheets";
	        document.forms[0].submit();
	}
	
}

//删除
function delProjectworksheets()
{
	var ids = getSelectedIds('id');
	if( ids=="" )
	{
		alert("请选择一条记录！");
		return false;
	}
	if( confirm("是否要删除所选的信息？") )
	{
		document.forms[0].action="deleteProjectworksheets.do?method=deleteProjectworksheets&ids=" + ids;
		document.forms[0].submit();
	}
}
	
	
function validateSelect(){ 
    var count = 0;
    var jysBox = $s("id");
    for(var i=0;i<jysBox.length;i++){
		if(jysBox[i].checked){
        	count++;
		}
	}
    return count;
}

//查看
function view(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能查看一条记录！");
		return;
	}else{
		document.forms[0].action="viewProjectworksheets.do?method=viewProjectworksheets";
	    document.forms[0].submit();
	}
}


//全选   
function checkAll()   
{ 
  
   var chk=document.getElementsByName("id");   
   for(var i=0;i<chk.length;i++)   
   { 
     if($('checkall').checked){
     	chk(i).checked=true; 
     }else{
        chk(i).checked=false; 
     } 
       
 }
  
}   

function setProjectName(id,name,projectid,undertakedepar,undertakedeparid,cost){
	window.opener.document.getElementById('${nameText}').value=name;
    window.opener.document.getElementById('worksheetsid').value=id;
    if(window.opener.document.getElementById('projectid')){
        window.opener.document.getElementById('projectid').value=projectid;
    }
    if(window.opener.document.getElementById('undertakedepar')){
        if($('bussinessType').value != '40003'){
           window.opener.document.getElementById('undertakedepar').value=undertakedepar;
        }
       
    }
   if(window.opener.document.getElementById('undertakedeparid')){
        window.opener.document.getElementById('undertakedeparid').value=undertakedeparid;
    }
       if(window.opener.document.getElementById('cost')){
        window.opener.document.getElementById('cost').value=cost;
    }
           if(window.opener.document.getElementById('material')!=null&&window.opener.document.getElementById('worksheets')){
        window.opener.document.getElementById('worksheets').value=cost;
    }
	window.close(); 

}
</script>
